#ifndef CHATMESSAGETOSERVER_H
#define CHATMESSAGETOSERVER_H

#include "./entities/message/superClass/message.h"

/*
Json数据格式
{
    "messageType": [ChatMessageToServer](int)
    "userId": [userId](string)
    "friendId": [friendId](string)
    "chatMessage": [chatMessage](int)
    "createTime": [createTime](string)
}
*/
class ChatMessageToServer : public Message
{
public:
    ChatMessageToServer() = delete;
    ChatMessageToServer(const UserId& userId, const FriendId& friendId,
                        const ChatMessage& chatMsg, const CreateTime& sendTime);
    ChatMessageToServer(const QJsonObject&);
    QJsonObject PackJsonData() const override;
    UserId getUserId() const;
    FriendId getFriendId() const;
    ChatMessage getChatMessage() const;
    CreateTime getSendTime() const;

private:
    UserId m_userId;
    FriendId m_friendId;
    ChatMessage m_chatMessage;
    CreateTime m_sendTime;
};

// 编译时注册
Q_DECLARE_METATYPE(ChatMessageToServer)

#endif // CHATMESSAGETOSERVER_H
